how to count stopwords in df

66

how to count stopwords in df -

from nltk.corpus import stopwords    
stop_words = set(stopwords.words('english'))

df['n'] = df['text'].str.split().apply(lambda x: len(set(x) & stop_words))

Comments

Submit
0 Comments